Skip to content

Improve support for conditional Square payments#2594

Draft
Crabcyborg wants to merge 7 commits intomasterfrom
improve_support_for_conditional_square
Draft

Improve support for conditional Square payments#2594
Crabcyborg wants to merge 7 commits intomasterfrom
improve_support_for_conditional_square

Conversation

@Crabcyborg
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg commented Nov 19, 2025

Related issue https://github.com/Strategy11/formidable-pro/issues/6100

This is mostly copied from where I added the same support for Stripe Link (https://github.com/Strategy11/formidable-stripe/pull/332).

  • When the Payment field is conditionally hidden, the submit button should not be disabled when Stripe Link is incomplete.
  • When the payment field is made visible, the submit button will be disabled if Stripe link is incomplete.

TODO

  • Test submit button conditional logic.
  • Consider minifying the JS since it's growing.

@Crabcyborg Crabcyborg changed the title Improve support for conditional square Improve support for conditional Square payments Nov 19, 2025
@Crabcyborg Crabcyborg added this to the 6.27 milestone Dec 8, 2025
@Crabcyborg Crabcyborg modified the milestones: 6.27, 6.28 Jan 5, 2026
@Crabcyborg Crabcyborg modified the milestones: 6.28, 6.29 Feb 12, 2026
@Crabcyborg Crabcyborg modified the milestones: 6.29, 6.30 Mar 9, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 7c7b6104-f6f1-4d19-b79e-3b7115e9fc86

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve_support_for_conditional_square

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented Apr 27, 2026

DeepSource Code Review

We reviewed changes in 1d27050...f94f0ef on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
PHP Apr 27, 2026 7:03p.m. Review ↗
JavaScript Apr 27, 2026 7:03p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread square/js/frontend.js Outdated
Comment thread square/js/frontend.js Outdated
* @returns {bool}
*/
function submitButtonIsConditionallyDisabled( formId ) {
return submitButtonIsConditionallyNotAvailable( formId ) && 'disable' === __FRMRULES[ 'submit_' + formId ].hideDisable;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected string concatenation


In ES2015 (ES6), we can use template literals instead of string concatenation.

Comment thread square/js/frontend.js Outdated
* @returns bool
*/
function submitButtonIsConditionallyNotAvailable( formId ) {
var hideFields = document.getElementById( 'frm_hide_fields_' + formId );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected var, use let or const instead


It is recommended to use let or const over var.
This will help prevent re-declaration of variables that are in the global scope when using var.

Comment thread square/js/frontend.js Outdated
* @returns bool
*/
function submitButtonIsConditionallyNotAvailable( formId ) {
var hideFields = document.getElementById( 'frm_hide_fields_' + formId );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected string concatenation


In ES2015 (ES6), we can use template literals instead of string concatenation.

Comment thread square/js/frontend.js Outdated
*/
function submitButtonIsConditionallyNotAvailable( formId ) {
var hideFields = document.getElementById( 'frm_hide_fields_' + formId );
return hideFields && -1 !== hideFields.value.indexOf( '["frm_form_' + formId + '_container .frm_final_submit"]' );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unexpected string concatenation


In ES2015 (ES6), we can use template literals instead of string concatenation.

Comment thread square/js/frontend.js
*/
function submitButtonIsConditionallyNotAvailable( formId ) {
const hideFields = document.getElementById( `frm_hide_fields_${ formId }` );
return hideFields && hideFields.value.includes( `["frm_form_${ formId }_container .frm_final_submit"]` );
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer using an optional chain expression instead, as it's more concise and easier to read


The optional chaining operator can be used to perform null checks before accessing a property, or calling a function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant